#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<string>
using namespace std;
/*string hash1[10] = { "","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz" };
vector<string> ret;
string path;
void dfs(string digits,int pos)
{
	if (path.size() == digits.size())
	{
		ret.push_back(path);
		return;
	}
	for (int i = pos; i < digits.size(); i++)
	{
		string s = hash1[digits[i] - '0'];
		for (int j = 0; j < s.size(); j++)
		{
			path += s[j];
			dfs(digits,i+1);
			path.pop_back();
		}
	}
}
vector<string> letterCombinations(string digits) {
	if (digits.size() == 0) return ret;
	dfs(digits,0);
	return ret;
}*/
//vector<string> ret;
//string path;
//int l, r;
//int _n;
//void dfs()
//{
//	if (r == _n)
//	{
//		ret.push_back(path);
//		return;
//	}
//	if (l < _n)
//	{
//		path += '(';
//		l++;
//		dfs();
//		path.pop_back();
//		l--;
//	}
//	if (r < l)
//	{
//		path += ')';
//		r++;
//		dfs();
//		path.pop_back();
//		r--;
//	}
//}
//vector<string> generateParenthesis(int n) {
//	_n = n;
//	dfs();
//	return ret;
//}
//vector<vector<int>> ret;
//vector<int> path;
//int _n, _k;
//void dfs(int pos)
//{
//	if (path.size() == _k)
//	{
//		ret.push_back(path);
//		return;
//	}
//	for (int i = pos; i <= _n; i++)
//	{
//		path.push_back(i);
//		dfs(i + 1);
//		path.pop_back();
//	}
//}
//vector<vector<int>> combine(int n, int k) {
//	_n = n, _k = k;
//	dfs(1);
//	return ret;
//}
int arr[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
int GetMonthDay(int year, int month,int day)
{
	int sum = 0;
	for (int i = 1; i < month; i++)
	{
		if (month == 2)
		{
			if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
			{
				sum+=arr[2] + 1;
			}
			else
				sum+= arr[2];
		}
		sum += arr[i];
	}
	sum += day;
	return sum;
}
int main()
{
	int num1;
	cin >> num1;
	int year1, month1, day1;
	year1 = num1 / 10000;
	month1 = (num1 / 100) % 100;
	day1 = num1 % 100;
	int num2;
	cin >> num2;
	int year2, month2, day2;
	year2 = num2 / 10000;
	month2 = (num2 / 100) % 100;
	day2 = num2 % 100;
	int gap = 0;
	int n = abs(year1 - year2);
	gap += 365 * n + n % 4;
	gap += abs(GetMonthDay(year1, month1,day1) - GetMonthDay(year2, month2,day2));
	cout << gap;
	return 0;
}